def solution(A) :
    count = 0
    n = len(A)
    L = [-1] + A
    pos = int((n+1)/2)
    candidate = L[pos]
    for i in range(1,n+1) :
        if (L[i] == candidate):
            count = count + 1
    if(count > pos):
        return candidate
    return -1
A = [2,2,2,2,2,3,4,4,4,6]
result = solution(A)
print(result)
